package com.casems.controller;


import com.casems.commons.vo.ResultVO;
import com.casems.service.RolePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tch
 * @since 2023-05-18
 */
@RestController
@RequestMapping("/rolePermission")
public class RolePermissionController {

    @Autowired
    RolePermissionService rolePermissionService;

    @RequestMapping("/update")
    public ResultVO updateRolePermission(@RequestParam("roleid") int roleid,
                                         @RequestParam("permissionid") int[] permissionid){
        return rolePermissionService.updateRolePermission(roleid, permissionid)?
                ResultVO.success("权限修改成功") : ResultVO.failed("权限修改失败");

    }
}

